/*
 * @Author: your name
 * @Description: 
 * @FilePath: /code/time/timer.cc
 */
#include "timer.h"

int64_t Timer::initial_id_ = 0;
std::mutex Timer::mutex_{};
void Timer::Run()
{
    callback_();
    if(repeated_times_ > 0)
    {
        repeated_times_--;
    }
    expired_time_ += interval_;
}
int64_t Timer::generateId()
{
    std::lock_guard lk(mutex_);
    initial_id_++;
    return initial_id_;
}